<template>
  <view class='container'>
    <!-- <block wx:for='{{news}}' wx:key=''> -->
    <view class='news-detail'>
      <view class='news-detail-title'>{{ news.title }}</view>
      <!-- <view class='news-detail-text'>{{news.content}}</view> -->
      <rich-text :nodes="news.content"></rich-text>
    </view>
    <!-- </block> -->
  </view>
</template>

<script>
import { request } from '../../utils/http';

export default {
  data() {
    return {
      news: null
    }
  },
  onLoad(options) {
    // var ths = this;
    //加载公告详情

    var params = {
      url: '/shop/notice/info/' + options.id,
      method: "GET",
      callBack: res => {
        res.content = res.content.replace(/width=/gi, 'sss=');
        res.content = res.content.replace(/height=/gi, 'sss=');
        res.content = res.content.replace(/ \/\>/gi, 'style="max-width:100%!important;display:block;" \/\>');
        this.news = res;
        console.log(res)
      }
    }
    request(params);
  }
}
</script>

<style lang="scss" scoped>
/* pages/news-detail/news-detail.wxss */

.news-detail {
  padding: 20rpx;
}

.news-detail .news-detail-title {
  font-size: 32rpx;
  font-weight: bold;
  line-height: 50rpx;
  padding: 20rpx;
}

.news-detail .news-detail-text {
  font-size: 28rpx;
  line-height: 46rpx;
  text-align: justify;
  text-justify: inter-ideograph;
  margin-top: 20rpx;
}
</style>